package com.Iconcat.system.service;

import com.Iconcat.system.entity.Investment;
import com.Iconcat.system.response.Result;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author zzq
 * @since 2023-12-19
 */
public interface InvestmentService extends IService<Investment> {
    void recordInvestment(Integer projectId, Integer userId, BigDecimal investmentAmount) throws Exception;
    List<Investment> getInvestmentsByProjectId(Integer projectId);

    boolean  hasInvested(Integer userId, Integer projectId);
    Result updateStatusToWithdrawn(Integer userId, Integer projectId);
    BigDecimal SelectProjectEarnings(Integer userId, Integer projectId);
    IPage<Map<String, Object>> selectProjectInvestment(Page<?> page, LambdaQueryWrapper<Investment> ew);
    Result updateProjectStatus(Integer projectId,Integer userId);
}
